<?php

require_once 'OpenID.php';

class OpenID_Assertion_Result
{
    protected $checkAuthResponse = null;
    protected $assertionMethod = null;
    protected $assertion = false;

    public function setCheckAuthResponse(OpenID_Message $message)
    {
        $this->checkAuthResponse = $message;
    }

    public function getCheckAuthResponse()
    {
        return $this->checkAuthResponse;
    }

    public function success()
    {
        return $this->assertion;
    }

    public function setAssertionResult($value)
    {
        $this->assertion = (bool)$value;
    }

    public function getAssertionMethod()
    {
        return $this->assertionMethod;
    }

    public function setAssertionMethod($method)
    {
        switch ($method) {
            case OpenID::MODE_ASSOCIATE:
            case OpenID::MODE_CHECKID_SETUP:
            case OpenID::MODE_CHECKID_IMMEDIATE:
            case OpenID::MODE_CHECK_AUTHENTICATION:
            case OpenID::MODE_CANCEL:
            case OpenID::MODE_SETUP_NEEDED:
                $this->assertionMethod = $method;
                break;
            default:
                throw new OpenID_Assertion_Exception('Invalid assertion method');
        }
    }
}
?>
